class MyArray<T>{
    Object[] objects = new Object[10];

    public T getElement(int index) {
        return (T)objects[index];
    }
    public void setElement(int index,T val){
        objects[index]=val;
    }
}
public class Test2 {
    public static void main(String[] args) {
        MyArray list = new MyArray();
        list.setElement(0,1);
        list.setElement(1,81);
        list.setElement(2,"我");

        System.out.println(list.getElement(0));
        System.out.println(list.getElement(2));
    }

    public static void main2(String[] args) {
        MyArray<Integer> myArray = new MyArray<>();
        myArray.setElement(0,1);
        myArray.setElement(1,2);
        myArray.setElement(2,3);

        System.out.println(myArray);

//        int a= myArray.getElement(0);
//        System.out.println(a);

//        myArray.setElement(3,"明天没课");
    }

    public static void main1(String[] args) {
        MyArray myArray = new MyArray();
        myArray.objects[0] = "我上早八";
        myArray.objects[1] = 1234;
        myArray.objects[2] = 3.14;
        myArray.objects[3] = false;

//        int str = myArray.getElement(1);
    }
}
